﻿using Npgsql;
using Real.Datos.Interfaces;
using Real.Entidad;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Text;
using DapperExtensions;
using Dapper;

namespace Real.Datos.Repositories
{
    public interface IActividadRepository : IRepository<Actividad>
    {

    }
    public class ActividadRepository : IActividadRepository
    {

        protected readonly IDbConnection _db;

        public ActividadRepository()
        {
            _db = new NpgsqlConnection(ConfigurationManager.ConnectionStrings["REAL"].ToString()); 
        }

        public IList<Actividad> FindAll()
        {
            using (IDbConnection _db = new NpgsqlConnection(ConfigurationManager.ConnectionStrings["REAL"].ToString()))
            {
                return _db.Query<Actividad>("SELECT * FROM ACTIVIDAD").ToList();
            }       
        }

        public IList<Actividad> Find(System.Linq.Expressions.Expression<Func<Actividad, bool>> predicate)
        {
            throw new NotImplementedException();
        }

        public Actividad FindById(int id)
        {
            throw new NotImplementedException();
        }

        public int Add(Actividad newEntity)
        {
            throw new NotImplementedException();
        }

        public bool Remove(int id)
        {
            throw new NotImplementedException();
        }

        public int Modify(Actividad entity)
        {
            throw new NotImplementedException();
        }
    }
}
